package com.yuju.login.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yuju.common.core.dao.IBaseDao;
import com.yuju.common.core.service.AbstractBaseService;
import com.yuju.login.dao.IMemberDao;
import com.yuju.login.dao.entity.Member;
import com.yuju.login.model.MemberModel;
import com.yuju.login.service.IMemberService;
import com.yuju.util.Utils;
/**
 * 
 * 类名：MemberServiceImpl  <br />
 *
 * 功能：
 *
 * @author : zhousc <br />
 * @Date : 2017年11月27日 上午10:33:59  <br />
 * @version : 1.1 <br />
 */
@Service
public class MemberServiceImpl extends AbstractBaseService<MemberModel, Member, String> implements IMemberService{

	@Autowired
	private IMemberDao memberDao;
	
	@Override
	public IBaseDao<MemberModel, Member, String> getDao() {
		// TODO Auto-generated method stub
		return memberDao;
	}

	/**
	 * 
	 * 功能: <br/>会员新增
	 * 		
	 * 重写：zhousc <br/>
	 * 
	 * @Date ：2017年11月22日 下午4:30:15<br/>
	 * 
	 * @param memberLevelModel
	 * @return <br/>
	 * @see com.yuju.common.core.service.AbstractBaseService#save(java.lang.Object)
	 */
	@Override
	public int save(MemberModel memberModel){
		
		memberModel.setHotelId(memberModel.getMyLike_hotelId());
		
		memberModel.setId(Utils.getUUID());
		memberModel.setGmtCreate(new Date());
		memberModel.setGmtModified(new Date());
		return this.getDao().saveSelective(memberModel);
	}
	
	public String saveMember(MemberModel memberModel) {
		memberModel.setHotelId(memberModel.getMyLike_hotelId());
		
		memberModel.setId(Utils.getUUID());
		memberModel.setGmtCreate(new Date());
		memberModel.setGmtModified(new Date());
		this.getDao().saveSelective(memberModel);
		return memberModel.getId();
	}
	
	/**
	 * 
	 * 功能: <br/>会员更新
	 * 
	 * 重写：zhousc <br/>
	 * 
	 * @Date ：2017年11月23日 上午9:43:32<br/>
	 * 
	 * @param memberLevelModel
	 * @return <br/>
	 * @see com.yuju.common.core.service.AbstractBaseService#updateSelective(java.lang.Object)
	 */
	@Override
	public int updateSelective(MemberModel memberModel){
		memberModel.setHotelId(memberModel.getMyLike_hotelId());
		memberModel.setGmtModified(new Date());
		return this.getDao().updateSelective(memberModel);
	}

	@Override
	public MemberModel getMember(MemberModel model) {
		return memberDao.getMember(model);
	}

//	@Override
//	public boolean selectByName(MemberModel memberModel) {
//		// TODO Auto-generated method stub
//		return null;
//	}
	
	
}
